#!/usr/bin/env bash
set -e

# NB: LambCI now uses a layer for gcc, only use this if you need an older version of GCC

VERSION=${1:-4.8.5}

echo "Installing GCC ${VERSION}..."

if ! [ -f /tmp/bin/gcc ]; then
  set -x
  curl -sSL https://lambci.s3.amazonaws.com/binaries/gcc-${VERSION}.tgz | tar -xz -C /tmp
  set +x
fi

export PATH=/tmp/bin:/tmp/sbin:$PATH
export LD_LIBRARY_PATH=/tmp/lib:/tmp/lib64:$LD_LIBRARY_PATH
export CPATH=/tmp/include
export LIBRARY_PATH=/tmp/lib

echo "GCC setup complete"
echo ""

set +e
